import dva from 'dva';
import React from 'react';
import ReactDOM from 'react-dom';
import {createBrowserHistory as createHistory} from 'history';
import { message } from 'antd'
var app = null;

app = dva({
    history: createHistory(),
    onError(error) {
        message.destroy();
        message.error(error.message);
    },
});

import {routerRedux} from 'dva/router';
import {BrowserRouter as Router, Route, Switch, Redirect, Link} from "react-router-dom";
const {ConnectedRouter} = routerRedux;
import Routes from './route/routes.js'
app.router(({ history }) => {
    return <ConnectedRouter history={history}>
            <Routes />
    </ConnectedRouter>
});
app.start("#root");

if (module.hot) {
    app.start("#root");
    module.hot.accept();
}